<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * select component for kissy editor.
 * @author yiminghe@gmail.com
 */
KISSY.add(&quot;editor/plugin/menubutton&quot;, function (S, Editor, MenuButton) {
<span id='KISSY-Editor-method-addSelect'>    /**
</span>     * add select to editor toolbar
     * @param {String} id control id
     * @param {Object} cfg select config
     * @param {Function} SelectType Select constructor. needs to extend {@link KISSY.MenuButton.Select}, Defaults to {@link KISSY.MenuButton.Select}.
     * @member KISSY.Editor
     */
    Editor.prototype.addSelect = function (id, cfg, SelectType) {

        SelectType = SelectType || MenuButton.Select;

        var self = this, prefixCls = self.get('prefixCls') + &quot;editor-&quot;;

        if (cfg) {
            cfg.editor = self;
            if (cfg.menu) {
                cfg.menu.zIndex = Editor.baseZIndex(Editor.ZIndexManager.SELECT);
            }
            if (cfg.elCls) {
                cfg.elCls = prefixCls + cfg.elCls;
            }
        }

        var s = new SelectType(S.mix({
            render: self.get(&quot;toolBarEl&quot;),
            prefixCls: prefixCls
        }, cfg)).render();

        if (cfg.mode == Editor.Mode.WYSIWYG_MODE) {
            self.on(&quot;wysiwygMode&quot;, function () {
                s.set('disabled', false);
            });
            self.on(&quot;sourceMode&quot;, function () {
                s.set('disabled', true);
            });
        }
        self.addControl(id + &quot;/select&quot;, s);
        return s;

    };

    return MenuButton;
}, {
    requires: ['editor', 'menubutton']
});</pre>
</body>
</html>
